package com.example.sports_meet;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.sports_meet.adapter.OptionAdapter;
import com.example.sports_meet.athlete.Athlete_mainActivity;
import com.example.sports_meet.entity.Option;
import com.example.sports_meet.event.Event_mainActivity;
import com.example.sports_meet.subject.Subject_mainActivity;
import com.example.sports_meet.volunteer.Volunteer_mainActivity;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import Judge.Judge_mainActivity;
import site.Site_mainActivity;

public class ManagerActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_manager);
        Objects.requireNonNull(getSupportActionBar()).hide();
        ListView lv_choose = findViewById(R.id.lv_manager);
        List<Option> options = new ArrayList<>();
        options.add(new Option("运动员",Athlete_mainActivity.class));
        options.add(new Option("志愿者", Volunteer_mainActivity.class));
        options.add(new Option("比赛", Event_mainActivity.class));
        options.add(new Option("项目", Subject_mainActivity.class));
        options.add(new Option("场地", Site_mainActivity.class));
        options.add(new Option("裁判", Judge_mainActivity.class));
        options.add(new Option("进行中比赛", OngoingeventActivity.class));

        OptionAdapter adapter = new OptionAdapter(this, options);
        lv_choose.setAdapter(adapter);
        lv_choose.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position) {
                    case 0:
                        // 点击第一个选项，跳转到Activity1
                        startActivity(new Intent(ManagerActivity.this, Athlete_mainActivity.class));
                        break;
                    case 1:
                        // 点击第二个选项，跳转到Activity2
                        startActivity(new Intent(ManagerActivity.this, Volunteer_mainActivity.class));
                        break;
                    case 2:
                        startActivity(new Intent(ManagerActivity.this, Event_mainActivity.class));
                        break;
                    case 3:
                        startActivity(new Intent(ManagerActivity.this, Subject_mainActivity.class));
                        break;
                    case 4:
                        startActivity(new Intent(ManagerActivity.this, Site_mainActivity.class));
                        break;
                    case 5:
                        startActivity(new Intent(ManagerActivity.this, Judge_mainActivity.class));
                        break;
                    case 6:
                        startActivity(new Intent(ManagerActivity.this, OngoingeventActivity.class));
                        break;

                }
            }
        });
    }
}